package com.etl.es.document;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * 商品
 *
 * @author: chenfenghai
 * @version: 1.0
 * @date: 2020-10-30 14:51
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
@ToString
@Document(indexName = "index-cms-goods",type = "_doc")
public class GoodsDocument {

    @Id
    private String orderId;

    @Field(type = FieldType.Keyword)
    private String orderCode;

    @Field(type = FieldType.Keyword)
    private String tenantCode;

    @Field(type = FieldType.Keyword)
    private String tenantName;

    @Field(type = FieldType.Keyword)
    private String cinemaCode;

    @Field(type = FieldType.Keyword)
    private String cinemaName;

    @Field(type = FieldType.Keyword)
    private String channelCode;

    @Field(type = FieldType.Keyword)
    private String channelName;

    @Field(type = FieldType.Byte)
    private Byte channelTypeCode;

    @Field(type = FieldType.Keyword)
    private String channelTypeName;


    @Field(type = FieldType.Keyword)
    private String orderYear;

    @Field(type = FieldType.Keyword)
    private String orderMonth;

    @Field(type = FieldType.Keyword)
    private String orderDay;

    @Field(type = FieldType.Keyword)
    private String orderHour;

    @Field(type = FieldType.Date, format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date orderDateTime;


    @Field(type = FieldType.Double)
    private Double goodsPrice;

    @Field(type = FieldType.Integer)
    private Integer goodsCount;

    @Field(type = FieldType.Byte)
    private Byte goodsType;

    @Field(type = FieldType.Keyword)
    private String goodsTypeName;
}
